package com.SwaggerTest.Controller;

import com.SwaggerTest.bean.Parent;
import com.SwaggerTest.bean.Person;
import com.SwaggerTest.bean.Result;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(value = "Result<T> 形式返回", tags = "Result<T> 形式返回")
@RestController
@RequestMapping("/HelloSwaggerResultBean")
public class HelloSwaggerResultBean {

    @RequestMapping(value = "/Result"  ,method = RequestMethod.GET)
    public Result<Parent> ControllerHelloSwaggerResultBean() {
        Parent parent= new Parent();
        parent.setAdress("银河系地球");
        parent.setAge("18");
        parent.setEmail("379753498@qq.com");
        parent.setName("swagger-bootstrap-ui 牛逼");
        Result<Parent> result = new Result<Parent>();
        result.setCode(200);
        result.setMessage("hello word Result<Parent>");
        result.setData(parent);
        return   result;
    }

    @RequestMapping(value = "/ResultList"  ,method = RequestMethod.GET)
    public Result<List<Parent>> ControllerHelloSwaggerResultBeanList() {
        List List= new ArrayList<Parent>();

        Parent parent= new Parent();
        parent.setAdress("银河系地球");
        parent.setAge("18");
        parent.setEmail("379753498@qq.com");
        parent.setName("swagger-bootstrap-ui 牛逼");
        List.add(parent);
        List.add(parent);
        List.add(parent);
        List.add(parent);
        List.add(parent);
        List.add(parent);
        Result<List<Parent>> result = new Result<List<Parent>>();
        result.setCode(200);
        result.setMessage("hello word Result<Parent>");
        result.setData(List);
        return   result;

    }



}
